from rest_framework import serializers
from . import models


class ListStatistics(serializers.ModelSerializer):
    """
    -  Statistics列表页序列化器

    -  注释字段
        count_date: 总浏览次数
        count_date_mobile: 浏览次数_手机端
        count_date_pc: 浏览次数_PC端
        count_date_ip: 不同ip浏览次数
        day: 日期文本
    """
    class Meta:
        model = models.Statistics
        fields = '__all__'
        # fields = ['count_date', 'count_date_mobile', 'count_date_pc', 'count_date_ip', 'day']

    count_date = serializers.IntegerField()     # 总浏览次数
    count_date_mobile = serializers.IntegerField()      # 浏览次数_手机端
    count_date_pc = serializers.IntegerField()      # 浏览次数_PC端
    count_date_ip = serializers.IntegerField()      # 不同ip浏览次数
    day = serializers.CharField()       # 日期


class RetrieveStatistics(serializers.ModelSerializer):
    class Meta:
        model = models.Statistics
        fields = '__all__'


